<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h2>Cadastrar Disciplina</h2>

            <p:panel styleClass="container_24 clearfix " style="background: none; border: none;"> 
                <h:form id="form" acceptcharset="utf-8">
                    <p:growl id="msg" life="3000" autoUpdate="true" showDetail="false"/>

                    <p class="subtitle">Dados Gerais</p>
                    
                    <p:outputLabel value="Curso:" styleClass="grid_3" for="cursoSelectOneMenu" rendered="#{managerCriarDisciplina.admin}" />
                    <div class="grid_8">
                        <p:selectOneMenu id="cursoSelectOneMenu"
                                         value="#{managerCriarDisciplina.curso}" 
                                         label="Selecione o curso" filter="true"
                                         filterMatchMode="contains"
                                         converter="cursoconverter"
                                         required="true" rendered="#{managerCriarDisciplina.admin}" 
                                         caseSensitive="false" panelStyle="width:220px">
                            <f:selectItem itemLabel="" itemValue="" />
                            <f:selectItems value="#{managerCriarDocente.cursos}" var="item" 
                                           itemLabel="#{item.codigo.concat(' - ').concat(item.nome)}" itemValue="#{item}" />  
                        </p:selectOneMenu>
                    </div>
                    <div class="clear" />

                    <p:outputLabel value="Código:" styleClass="grid_3" for="codigoInputText"/>
                    <p:inputText id="codigoInputText" value="#{managerCriarDisciplina.disciplina.codigo}" 
                                 required="true" styleClass="grid_7"/>

                    <p:outputLabel value="Ocupa sala" styleClass="grid_3" for="ocupaSalaSelectBooleanCheckbox" />
                    <p:selectBooleanCheckbox id="ocupaSalaSelectBooleanCheckbox" styleClass="grid_1"
                                             value="#{managerCriarDisciplina.disciplina.ocupaSala}" />

                    <div class="clear"/>

                    <p:outputLabel value="Nome:" styleClass="grid_3" for="nomeInputText"/>
                    <p:inputText id="nomeInputText" value="#{managerCriarDisciplina.disciplina.nome}" 
                                 required="true" styleClass="grid_20"/>

                    <div class="clear"/>
                    <div class="buttonAction">
                        <p:commandButton value="Salvar" icon="ui-icon-disk" 
                                         actionListener="#{managerCriarDisciplina.salvar()}" 
                                         update="@form" styleClass="ui-priority-primary"/>
                        <p:button value="Cancelar" icon="ui-icon-circle-close"
                                  href="indexdisciplina.xhtml"/>

                    </div>
                </h:form>
            </p:panel> 
        </ui:define>
    </ui:composition>
</html>